﻿/*
 * Create By:Steven Jiang
 * Create Date:2009-4-24 10:15
 * Description:
 *    系统配置管理对象  
 * 
 * 
 * 
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Jumpton.Persistent;
using Jumpton.SFA.Server.BusinessRule;

namespace Jumpton.SFA.Server.BusinessRule
{
    public class SystemConfigManager:IBusinessLogic
    {
        /// <summary>
        /// 根据系统配置枚举来获取相应的配置
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public Jumpton.SFA.Server.Entity.SystemConfig Load(Jumpton.SFA.Server.Entity.ConfigType type, decimal DomainID)
        {
            return (Jumpton.SFA.Server.Entity.SystemConfig)ObjectRow.Load(typeof(Jumpton.SFA.Server.Entity.SystemConfig), "Code='" + type.ToString() + "' and Domain_id=" + DomainID);
        }

        /// <summary>
        /// 获取所有系统配置项
        /// </summary>
        /// <returns></returns>
        public ObjectTable GetAllConfig()
        {
            return new ObjectTable(typeof(Jumpton.SFA.Server.Entity.SystemConfig));
        }

        /// <summary>
        /// 保存配置项
        /// </summary>
        /// <param name="config"></param>
        public void Save(Jumpton.SFA.Server.Entity.SystemConfig config)
        {
            ((IBusinessLogic)this).Save(config);
        }

        #region IBusinessLogic Members


        /// <summary>
        /// 该方法目前不支持
        /// </summary>
        /// <param name="Condition"></param>
        /// <returns></returns>
        [Obsolete("该方法目前不支持")]
        public object Load(decimal ID)
        {
            throw new NotImplementedException();
        }


        /// <summary>
        /// 该方法目前不支持
        /// </summary>
        /// <param name="Condition"></param>
        /// <returns></returns>
        [Obsolete("该方法目前不支持")]
        public object LoadByCode(string Code)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// 该方法目前不支持
        /// </summary>
        /// <param name="Condition"></param>
        /// <returns></returns>
        [Obsolete("该方法目前不支持")]
        public object LoadWithCondition(string Condition)
        {
            throw new NotImplementedException();
        }

        void IBusinessLogic.Save(object obj)
        {
            if (obj != null)
            {
                (obj as ObjectRow).Save();
            }
        }

        #endregion
    }
}
